#include <stdio.h>
#include <string>
#include <vector>
#include "iostream"
#include <sstream>

int split_string(const char* str, char delimiter, std::vector<std::string>& vec) {
    if (!str) return -1;

    std::stringstream ss;
    ss.str(str);
    std::string item;
    while(std::getline(ss, item, delimiter))
        vec.push_back(item);

    return 0;
}

int main(int argc, const char **argv) {
    std::vector<std::string> vec;

    split_string("11:22:33", ':', vec);
    printf("%ld\n", vec.size());
    for (const auto& str : vec) {
        printf("%s\n", str.c_str());
    }

    return 0;
}
